/**
 * Created by Administrator on 2019/8/30.
 */

function check_username(){
    var flag=false;
    var usernameElement = document.querySelector("input[name='username']");//获得用户名元素空控件
    var username = usernameElement.value;
    var user_alert=usernameElement.nextElementSibling;
    if(username == null || username == ""){
       user_alert.innerText="qunidaye";
    }else if(!/^[0-9A-Za-z]{6,12}$/.test(username)){
        user_alert.innerText="用户名必须是字母或下划线组成,长度在6-12字符";
    }else{
        user_alert.innerText="";
        flag=true;
    }
    return flag;
}

function check_password(){
    var flag =false;
    var pwdElement = document.querySelector("input[name='pwd']");
    var pwd = pwdElement.value;
    var pwd_alert = pwdElement.nextElementSibling;
    if(pwd == null || pwd == ""){
        pwd_alert.innerText="密码不能为空";
    }else if(!/^[0-9A-Za-z]{6,12}$/.test(pwd)){
        pwd_alert.innerText="密码必须是字母或下划线组成,长度在6-12字符";
    }else{
        pwd.innerText="";
        flag=true;
    }
    return flag;
}


function check_gender() {
    var flag = false;
    var genderElement = document.querySelectorAll("input[name='gender']");
    var gender = genderElement.value;
    for (var i = 0; i < gender.length; i++) {
        if (gender == null || gender == "") {

        }
}
    var gender_alert = genderElement.nextElementSibling;
}